package com.wunong.smart.commission.domain.state.impl;

import com.wunong.smart.commission.application.request.support.CancelCommissionRequest;
import com.wunong.smart.commission.application.request.support.CreateCommissionRequest;
import com.wunong.smart.commission.application.request.support.FinishCommissionRequest;
import com.wunong.smart.commission.client.enums.CommissionOperationEnum;
import com.wunong.smart.commission.client.enums.CommissionStatusEnum;
import com.wunong.smart.commission.domain.model.CommissionDomain;
import com.wunong.smart.commission.domain.state.AbstractCommissionState;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

/**
 * @author create by zealot.zt
 */
@Slf4j
@Component
public class ProcessionCommissionState extends AbstractCommissionState {

    @Override
    public CommissionDomain finish(FinishCommissionRequest request, CommissionDomain domain) {
        return (CommissionDomain) operate(CommissionOperationEnum.FINISH, request, domain);
    }

    @Override
    public CommissionDomain cancel(CancelCommissionRequest request, CommissionDomain domain) {
        return (CommissionDomain) operate(CommissionOperationEnum.CANCEL, request, domain);
    }

    @Override
    public CommissionDomain create(CreateCommissionRequest request, CommissionDomain domain) {
        return (CommissionDomain) operate(CommissionOperationEnum.CREATE, request, domain);
    }

    @Override
    public CommissionStatusEnum getStatusEnum() {
        return CommissionStatusEnum.PROCESSING;
    }

}
